package com.lintf.web.controller.bot;

import com.lintf.bot.domain.dto.BotBillAddDTO;
import com.lintf.bot.domain.dto.BotBillListDTO;
import com.lintf.bot.domain.dto.BotBillUpdateDTO;
import com.lintf.bot.service.IBotBillService;
import com.lintf.common.core.controller.BaseController;
import com.lintf.common.core.domain.AjaxResult;
import com.lintf.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ system:Mac
 * @ author:lin tingfeng
 * @ data:2024/1/8 13:19
 * @ package_name:com.lintf.web.controller.bot
 * @ project_name:mobile-project
 * @ desc:
 */
@RestController
@RequestMapping("/bot/bill")
public class BotBillController extends BaseController {

    @Autowired
    private IBotBillService botBillService;

    @GetMapping("/getById")
    public AjaxResult getById(BotBillListDTO dto){
        return AjaxResult.success(botBillService.getById(dto));
    }

    @GetMapping("/getSimpleById")
    public AjaxResult getSimpleById(BotBillListDTO dto){
        return AjaxResult.success(botBillService.getById(dto.getId()));
    }

    @GetMapping("/list")
    public TableDataInfo list(BotBillListDTO dto){
        return getDataTable(botBillService.list(dto));
    }

    @PostMapping("/add")
    public AjaxResult add(@RequestBody BotBillAddDTO dto){
        botBillService.add(dto);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody BotBillUpdateDTO dto) {
        botBillService.update(dto);
        return AjaxResult.success();
    }

    @PostMapping("/remove")
    public AjaxResult remove(@RequestBody BotBillUpdateDTO dto) {
        botBillService.remove(dto);
        return AjaxResult.success();
    }

}
